package Exercise;

//递归
public class CalculateExe2 {
    public static void main(String[] args) {

        System.out.println(getSum(6));
//        System.out.println(getPeach(10));
//        System.out.println(getStair(20));

//        System.out.println(getStair1(20));
    }

    public static int getStair1(int num){
        if(num==1){
            return 1;
        }else if(num==2){
            return 2;
        }else if(num==3){
            return 4;
        }else{
            return getStair1(num-3)+getStair1(num-2)+getStair1(num-1);
        }
    }

    public static int getStair(int num){
        if(num==1){
            return 1;
        }else if(num==2){
            return 2;
        }else{
            return getStair(num-2)+getStair(num-1);
        }
    }


    public static int getPeach(int day){
        if(day==1){
            return 1;
        }else{
            return (getPeach(day-1)+1)*2;
        }

    }


    public static int getSum(int month){
        if(month==1||month ==2){
            return 1;
        }else{
            return getSum(month-1)+getSum(month-2);
        }
    }

}
